<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../assets/js/common/element/index.css" rel="stylesheet">
<link href="../../build/common/base.css" rel="stylesheet">
<script type="text/javascript" src="../../build/common/base.js"></script>
<script type="text/javascript" src="../../build/common/vueEdit.js"></script>
</head>
<body>
	<div id="ctrl">
		<div class="ibox-title">
			<a class="btn btn-primary fa-save" href="javascript:void(0)" onclick="save()">保存</a>
		</div>
		<form class="form-horizontal">
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
				<div class="col-sm-10">
					<input type="email" class="form-control" id="inputEmail3" placeholder="Email">
				</div>
			</div>
			<div class="form-group">
				<label for="inputPassword3" class="col-sm-2 control-label">Password</label>
				<div class="col-sm-10">
					<input type="password" class="form-control" id="inputPassword3" placeholder="Password">
				</div>
			</div>
		</form>
		<iframe id='businessDataIframe' src='' @load='iframeHeight(this)' style='width: 100%; border: none;height: 400px'></iframe>
	</div>
</body>


<script type="text/javascript">
	var data ;
	
	// 获取业务数据，表单名
	$(function(){
		// 从后台获取 数据
		var formKey = "aaaaaa";
		data = {
				inputEmail3:"abc@qq.com",
				inputPassword3:"1",
				businessData:{  // 业务对象的JSON
					Demo: {"bm":"科技部","mz":"系统管理员","nl":12,},  
				}
		}
		$("#businessDataIframe").attr("src", "http://localhost:8080/bpm-explorer/form/formDef/businessDataView.html?key="+formKey);
	})
	
	// 提供给子页面
    function getBusinessData(){
		return data.businessData;
	}
		
	 function save(){
		 var businessDataIframe=document.getElementById("businessDataIframe").contentWindow;
		 debugger;
		 // 调用 自定义表单的  getData() 方法获取业务对象数据
		 var businessData = businessDataIframe.getData(true);
		 // 如果 返回 false 则说明校验不通过取消提交
		 if(businessData === false) return;
		 
		 data.businessData = businessData;
		 // 提交后 可以自行保存业务数据，也可以调用表单保存接口去保存业务数据
		 alert(JSON.stringify(data));
	 }
	 
	 
	 
</script>
</html>